#include<bits/stdc++.h>
using namespace std;
const int N=100005;

int n,m;
vector<int> edges[N];
bool visit[N];
int fath[N][20];
int h[N],lg[N];

void dfs(int fa,int son){
	visit[fa]=true;visit[son]=true;
	fath[son][0]=fa;
	h[son]=h[fa]+1;
	for(int i=1;i<=lg[h[son]];i++){
		fath[son][i]=fath[fath[son][i-1]][i-1];
	}
	for(auto& u:edges[son]){
		if(!visit[u]){
			dfs(son,u);
		}
	}
}
int LCA(int x,int y){
	if(h[x]<h[y]) swap(x,y);
	while(h[x]>h[y]){
		x=fath[x][lg[h[x]-h[y]]];
	}
	if(x==y){
		return x;
	}
	for(int k=lg[h[x]];k>=0;k--){
		if(fath[x][k]!=fath[y][k]){
			x=fath[x][k];
			y=fath[y][k];
		}
	}
	return fath[x][0];
}
int main(){
	scanf("%d%d",&n,&m);
	int s,t;
	for(int i=0;i<n-1;i++){
		scanf("%d%d",&s,&t);
		edges[s].emplace_back(t);
		edges[t].emplace_back(s);
	}
	//
	lg[1]=1;
	for(int i=2;i<=n;i++){
		lg[i]=lg[i-1]+(1<<lg[i-1]==i?1:0);
		lg[i-1]--;
	}
	lg[n]--;
	//
	memset(visit,false,sizeof(visit));
	h[0]=-1;
	dfs(0,1);
	//
	int s2,t2;
	int p1,p2,len1,len2;
	int p[4];
	int x[4];
	for(int i=0;i<m;i++){
		scanf("%d%d%d%d",&s,&t,&s2,&t2);
		p1=LCA(s,t);
		p2=LCA(s2,t2);
		len1=h[s]+h[t]-2*h[p1];
		len2=h[s2]+h[t2]-2*h[p2];
		p[0]=LCA(s,p2);p[1]=LCA(t,p2);
		x[0]=h[s]+h[p2]-2*h[p[0]];
		x[1]=h[t]+h[p2]-2*h[p[1]];
		if(x[0]+x[1]==len1){
			printf("Y\n");
			continue;
		}
		p[0]=LCA(s2,p1);p[1]=LCA(t2,p1);
		x[0]=h[s2]+h[p1]-2*h[p[0]];
		x[1]=h[t2]+h[p1]-2*h[p[1]];
		if(x[0]+x[1]==len2){
			printf("Y\n");
		}
		else{
			printf("N\n");
		}
	}
	return 0;
}
